﻿Public Class SelectSurfaceAndScene
  Public Event SceneCount(ByVal surface As Integer, ByRef currentScene As Integer, ByRef sceneCount As Integer)

  Public Sub New()
    Me.InitializeComponent()

    Me.ComboBoxSurface.Items.Add(Language.GetLanguageString("BottomMenuMusic"))
    Me.ComboBoxSurface.Items.Add(Language.GetLanguageString("BottomMenuPodcast"))
    Me.ComboBoxSurface.Items.Add(Language.GetLanguageString("BottomMenuRadio"))
    Me.LabelWhichSurface.Text = Language.GetLanguageString("Surface") & ":"
    Me.LabelScene.Text = Language.GetLanguageString("Scene") & ":"
  End Sub

  Public Overrides Property BackColor() As System.Drawing.Color
    Get
      Return MyBase.BackColor
    End Get
    Set(ByVal value As System.Drawing.Color)
      MyBase.BackColor = value
      Me.LabelScene.BackColor = value
      Me.LabelWhichSurface.BackColor = value
    End Set
  End Property

  Public Property BackColorTextbox() As System.Drawing.Color
    Get
      Return Me.ComboBoxScene.BackColor
    End Get
    Set(ByVal value As System.Drawing.Color)
      Me.ComboBoxScene.BackColor = value
      Me.ComboBoxSurface.BackColor = value
    End Set
  End Property

  Public Overrides Property ForeColor() As System.Drawing.Color
    Get
      Return MyBase.ForeColor
    End Get
    Set(ByVal value As System.Drawing.Color)
      MyBase.ForeColor = value
      Me.LabelScene.ForeColor = value
      Me.LabelWhichSurface.ForeColor = value
    End Set
  End Property

  Private Sub ComboBoxSurface_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxSurface.SelectedIndexChanged
    Me.RefreshSurfaceScenes()
  End Sub

  Public Sub RefreshSurfaceScenes()
    Dim surface As Integer = Me.ComboBoxSurface.SelectedIndex
    Dim curScene As Integer = 0
    Dim sceneCount As Integer = 0
    RaiseEvent SceneCount(surface, curScene, sceneCount)

    Me.ComboBoxScene.Items.Clear()
    For i As Integer = 0 To sceneCount - 1
      Me.ComboBoxScene.Items.Add(i.ToString)
    Next
    Me.ComboBoxScene.Items.Add(Language.GetLanguageString("ControlAddScene"))

    Me.ComboBoxScene.SelectedIndex = curScene
  End Sub

  Public Property Surface() As Integer
    Get
      Return Me.ComboBoxSurface.SelectedIndex
    End Get
    Set(ByVal value As Integer)
      If value >= 0 AndAlso value <= Me.ComboBoxSurface.Items.Count - 1 Then
        Me.ComboBoxSurface.SelectedIndex = value
      End If
    End Set
  End Property

  Public Property Scene() As Integer
    Get
      Return Me.ComboBoxScene.SelectedIndex
    End Get
    Set(ByVal value As Integer)
      If value >= 0 AndAlso value <= Me.ComboBoxScene.Items.Count - 1 Then
        Me.ComboBoxScene.SelectedIndex = value
      End If
    End Set
  End Property
End Class
